cc.Class({
    extends: cc.Component,

    properties: {
        _headurl: "",
        _username: "",
        _score: 0,
        _ready: 0,
        
        headurl: {
            get: function () {
                return this._headurl;
            },
            set: function (value) {
                this._headurl = value;
            },
        },
        
        username: {
            get: function () {
                return this._username;
            },
            set: function (value) {
                this._username = value;
            },
        },
        
        score: {
            get: function () {
                return this._score;
            },
            set: function (value) {
                this._score = value;
            },
        },
        
        ready: {
            get: function () {
                return this._ready;
            },
            set: function (value) {
                this._ready = value;
            },
        },
    },

    onLoad: function () {
        //头像
        var headurl_node = cc.find("head_icon", this.node);
        // headurl_node.getComponent(cc.Sprite).spriteFrame = cc.SpriteFrameCache.getSpriteFrame("");
        //用户名
        var username_node = cc.find("label_playername", this.node);
        username_node.getComponent(cc.Label).string = this._username;
        
        //分数
        var score_node = cc.find("label_score", this.node);
        score_node.getComponent(cc.Label).string = this._score;
        
        //准备
        var ready_node = cc.find("spr_ready", this.node);
        if (this._ready) {
            ready_node.opacity = 255;
        }
    },
    
    updateHeadMessage: function () {
        //分数
        var score_node = cc.find("label_score", this.node);
        score_node.getComponent(cc.Label).string = this._score;
        
        //准备
        var ready_node = cc.find("spr_ready", this.node);
        if (this._ready) {
            ready_node.opacity = 255;
        } else {
            ready_node.opacity = 0;
        }
    },
});
